<!--申请成功-->
<template>
  <view class="rma-success">
    <h4 v-if="comeRoute == 'pages/order/reLogistics'">
      <i class="iconfont icon-ok"></i>
      提交成功 等待退款
    </h4>
    <view v-else>
      <h4>
        <i class="iconfont icon-ok"></i>
        申请成功 请等待审核
      </h4>
      <p><view @click="goOrderDetail" class="a-link">查看详情</view></p>
    </view>
    <view class="btn" @click="_backhome">继续购物</view>
  </view>
</template>
<script>
import api from '@/api/api';
import { SYSTEM_INFO, CUSTOMER_INFO, CART_KEY } from '@/utils/constant';
import tip from '@/utils/tip';
export default {
  config: {
    navigationStyle: 'custom',
    navigationBarTitleText: '退货退款'
  },

  data() {
    return {
      comeRoute: '',
      orderNo: '',
      refundId: '',
      jumpToHome: 0,
      nowPages:''
    };
  },
  onLoad(option) {
    this.orderNo = option.orderNo;
    this.refundId = option.refundId;
    let pages = getCurrentPages();
    let prevpage = pages[pages.length - 2];
    var currPage = pages[pages.length - 1];
    this.nowPages = currPage.route;
    if (prevpage == undefined) {
      this.comeRoute = '';
    } else {
      this.comeRoute = prevpage.route ? prevpage.route : '';
    }
  },
  onShow() {
   getApp().cl_tracker.track('mini_program_view', {
         path:  this.nowPages,
         pageName: '退货退款',
       }) 
  },
  //  返回按钮跳转页面
  onUnload(option) {
    if (this.comeRoute == 'pages/return/details' || this.comeRoute == 'pages/return/return' || this.comeRoute == 'pages/order/reLogistics') {
      if (this.jumpToHome == 0) {
        setTimeout(() => {
          uni.navigateTo({
            url: '/pages/order/details?orderNo=' + this.orderNo + "&refundId=" + this.refundId
          });
        }, 100);
      }
    }
  },

  methods: {
    // 根据订单号查询详情
    goOrderDetail() {
      uni.redirectTo({
        url: '/pages/return/details?refundId=' + this.refundId + '&orderNo=' + this.orderNo
      });
    },
    _backhome() {
      this.jumpToHome = 1;
      setTimeout(function() {
        uni.reLaunch({
          url: '/pages/home/home'
        });
      }, 50);
    }
  }
};
</script>
<style lang="less">
@import '../../static/styles/style';

.rma-success {
  padding: 300rpx 20rpx 0;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
  z-index: 2;
}

.rma-success h4 {
  text-align: center;
  margin-bottom: 15px;
  font-size: 36rpx;
  display: block;
}

.rma-success strong {
  font-weight: 700;
}

.rma-success p {
  display: block;
  text-align: center;
}

.rma-success .btn {
  width: 80%;
  height: 60rpx;
  line-height: 60rpx;
  position: relative;
  display: block;
  margin: 120rpx auto 46rpx;
}

.rma-success .a-link {
  text-decoration: underline;
  margin-top: 8rpx;
}

.rma-success .icon-ok {
  font-size: 42rpx;
  margin-right: 10rpx;
}
</style>
